#coding=utf-8
from db_manager import DBManager
from config import * 

from tool import Tool

class VerfUser(object):
    def __init__(self,cfgParam):
            
        self.cfgParam = cfgParam
        self.manager = DBManager(db,ip,ur,pd)
        self.manager.connect()
        self.tool  = Tool()
    def login(self):
        "手机号码 密码"
        mustkeys = ["mobile","password"]
        ret = self.tool.check_param(mustkeys,self.cfgParam) 
        if not ret["status"]:
            return ret
        print self.cfgParam
        condition = {'mobile':'18621608101','password':'123456'}
        condition = {'mobile':self.cfgParam["mobile"],'password':self.cfgParam["password"]}
        result = self.manager.smartQuery(merchant_info,condition)         
        if result:
            ret['result'] = result
        else:
            ret['info'] = "登录信息有误"
            ret['info_code'] = 10002

        return ret

    def login_success(self):
        "登录成功返回商户信息"    


    def forget_password(self):
        "判断是否有这个手机号码  生成验证码 发送短信给它 (60s重发)"
        pass 
    
    def update_password(self):
        "短信验证码认证 是否正确   修改密码"
        pass




if __name__ == '__main__':
    u = VerfUser('1')
    print u.login()
    




